/**
 * @author Vår Plan team
 */

$(function(){
	// Accordion
	$("#accordion").accordion({ header: "h3" });
	$("#button").css("visibility","visible");
	$("#login").css("display","none");
	$("#login").css("visibility","hidden");
	$("#button").click(function(){
			$("#mp_login").trigger("submit");
		});
	$("#searchButton").click(function(){
		// Put any form validation or ajax handling of searching here
			$("#searchForm").trigger("submit");
		});
});

/**
* Function to check all checkboxes in a form
* Use: <input type="checkbox" name="check-all" onclick="checkAll(this.form, 'check[]', this.checked);" />
* Remember: The name of the checkboxes has to be check[] for the above to work.
*/
function checkAll(form, arr, mark) { 
  for (i = 0; i <= form.elements.length; i++) { 
    try { 
      if(form.elements[i].id == arr) { 
        form.elements[i].checked = mark; 
      }
    } catch(e) {} 
  }
}